<?php
	require 'php/template.php';

	session_start();
	if(isset($_SESSION['logged_in']))
	{
		if($_SESSION['logged_in'] == TRUE)
		{
			header(sprintf("Location: %s", "index.php"));
			exit();
		}
	}	
	
	//load template
	$template = new Template("Daclo Language School",'login.html');
	if(!isset($_GET['validationresult']))
	{
		$template->setContent("{ERROR}", "");
	} else
	{
		if($_GET['validationresult'] == "FALSE")
		{
			$message = "<td><font color='red'>Wrong username or password. Please check again</font></td>";
			$template->setContent("{ERROR}", $message);
		} else
		{
			$template->setContent("{ERROR}", "");
		}
	}
	$template->display();